package com.dingxin.ship_together_api.controller;

/**
 * Author: ctj
 * Date: 2023-01-10
 * Time: 14:45
 */

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.dev33.satoken.util.SaResult;
import com.dingxin.ship_together_api.entity.IntentionInfo;
import com.dingxin.ship_together_api.entity.constant.PermissionConstant;
import com.dingxin.ship_together_api.entity.vo.PageQueryVo;
import com.dingxin.ship_together_api.service.IntentionInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SaCheckLogin
@RequestMapping("intention")
public class IntentionController {

    @Autowired
    private IntentionInfoService intentionInfoService;

    @RequestMapping("add")
    @SaCheckPermission(PermissionConstant.System_IntentionMng_Add)
    public SaResult add(@RequestBody IntentionInfo intentionInfo){
        return SaResult.ok().setData(intentionInfoService.save(intentionInfo));
    }

    @RequestMapping("list")
    @SaCheckPermission(PermissionConstant.System_IntentionMng_Qry)
    public SaResult list(@RequestBody PageQueryVo pageQueryVo){
        return SaResult.ok().setData(intentionInfoService.selectPage(pageQueryVo));
    }
}
